<?php
chdir('../');

require('includes/setUp.php');

try {

  Validations::validateString($_POST['userName'], 30, Validations::regexp_UserName);     
  $result = $db->getRepository('User')->findOneBy(array('userName' => $_POST['userName']));

} catch (Exception $ex) {
  globalFunc::inlineStatementError(T_('Error!'));
  die;
}

if ($result == null) {
  globalFunc::inlineStatementOk(T_('OK'));
} else {
  globalFunc::inlineStatementError(T_('Unavailable'));
}

